package com.yhgm.controller;

import com.yhgm.common.BaseResponse;
import com.yhgm.entity.ImageSearch;
import com.yhgm.pojo.Image;
import com.yhgm.service.impl.ImageSearchServiceImpl;
import com.yhgm.utils.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("image")
public class DataSearchController {
    // TODO: 2024/5/14 ES检索
    @Resource
    private ImageSearchServiceImpl imageSearchService;
    @PostMapping("getById")
    public R getById(Long id){
        return imageSearchService.getById(id);
    }
    @PostMapping("query")
    public R search(@RequestBody ImageSearch imageSearch,Integer page,Integer size){
        return imageSearchService.search(imageSearch,(page-1)*size,size);
    }
    @PostMapping("insert")
    public R insert(@RequestBody ImageSearch imageSearch){
        return imageSearchService.insert(imageSearch);
    }
}
